package assign2;

import java.util.Comparator;

/**
 * Assignment 2 - CustomComparator.java
 * Used with Collections.sort to compare the lab coords
 * based on alpha-numeric rules.
 *
 * @author Kelton Kowalchuk A00773813
 * @author Jitin Dhillon A00806890
 * 
 */
public class CustomComparator implements Comparator<int[]> {
    @Override
    public int compare(int[] a1, int[] a2) {
        if(a1[0] == a2[0]) {
            if(a1[1] < a2[1])
                return -1;
            else if (a1[1] > a2[1])
                return 1;
            else
                return 0;
        } else {
            if(a1[0] < a2[0])
                return -1;
            else if (a1[0] > a2[0])
                return 1;
            else
                return 0;
        }
       
    }
}
